from rest_framework import serializers
from orders.models import OrderInfo, OrderGoods


class SkuSerializers(serializers.Serializer):
    name = serializers.CharField()
    default_image = serializers.ImageField()


class OrderGoodsSerializers(serializers.ModelSerializer):
    sku = SkuSerializers(read_only=True)

    class Meta:
        model = OrderGoods
        fields = '__all__'


class OrderSerializers(serializers.ModelSerializer):
    skus = OrderGoodsSerializers(many=True, read_only=True)

    class Meta:
        model = OrderInfo
        fields = '__all__'
